---
title: Deleting a Predictor
sidebarTitle: Delete()
---

## The `db.models.deleteOne()` Method

## Description

The `db.models.deleteOne()` method deletes an ML model specified in its argument.

## Syntax

Here is the syntax:

```sql
db.models.deleteOne({name: "predictor_name"});
```

On execution, we get:

```json
{
  "acknowledged": true,
  "deletedCount": 1
}
```

Where:

| Name   | Description                      |
| ------ | -------------------------------- |
| `name` | Name of the model to be deleted. |

## Example

### Listing All the Predictors

Before deleting a predictor, let's list all the available predictors using the
`db.models.find()` method.

```sql
db.models.find({});
```

On execution, we get:

```json
{
    "name": "home_rentals_model",
    "status": "complete",
    "accuracy": "1.0",
    "predict": "rental_price",
    "update_status": "up_to_date",
    "mindsdb_version": "22.8.3.1",
    "error": null,
    "select_data_query": "",
    "training_options": ""
},
{
    "name": "other_model",
    "status": "complete",
    "accuracy": "1.0",
    "predict": "value_to_be_predicted",
    "update_status": "up_to_date",
    "mindsdb_version": "22.8.3.1",
    "error": null,
    "select_data_query": "",
    "training_options": ""
}
```

### Dropping a Predictor

The `db.models.deleteOne()` method drops the model collection called
`home_rentals_model`.

```sql
db.models.deleteOne({name: "home_rentals_model"});
```

On execution, we get:

```json
{
  "acknowledged": true,
  "deletedCount": 1
}
```

### Validating the Deletion

You can validate that the model was removed by listing all the predictors.

```sql
db.models.find({});
```

On execution, we get:

```json
{
  "name": "other_model",
  "status": "complete",
  "accuracy": "1.0",
  "predict": "value_to_be_predicted",
  "update_status": "up_to_date",
  "mindsdb_version": "22.8.3.1",
  "error": null,
  "select_data_query": "",
  "training_options": ""
}
```
